Skip to content

fix: compute texture dimensions per-bin in multi-pack mode - #185

Open
milescremen-vgw wants to merge 1 commit into
pixijs:mainfrom
milescremen-vgw:fix/texture-packer-multipack-per-bin-dimensions
Open

milescremen-vgw wants to merge 1 commit into
pixijs:mainfrom
milescremen-vgw:fix/texture-packer-multipack-per-bin-dimensions

Conversation

@milescremen-vgw

Copy link
Copy Markdown

Fixes #171

Previously, fitTextureToPacker was called once on the entire packer, using only the first bin's rect layout to determine width/height. In multi-pack scenarios where textures overflow into multiple bins, each bin can have different dimensions. This caused subsequent bins to use incorrect (oversized) sheet dimensions from the first bin.

Move the fitTextureToPacker call into the per-bin loop within both createTextures and createJsons, so each bin gets its own correctly computed width and height.

@milescremen-vgw
milescremen-vgw marked this pull request as draft August 12, 2026 01:33
@milescremen-vgw
milescremen-vgw force-pushed the fix/texture-packer-multipack-per-bin-dimensions branch 3 times, most recently from 84b356f to 7b659f8 Compare August 12, 2026 02:17
Previously, fitTextureToPacker was called once on the entire packer,
using only the first bin's rect layout to determine width/height. In
multi-pack scenarios where textures overflow into multiple bins, each
bin can have different dimensions. This caused subsequent bins to use
incorrect (oversized) sheet dimensions from the first bin.

Move the fitTextureToPacker call into the per-bin loop within both
createTextures and createJsons, so each bin gets its own correctly
computed width and height.
@milescremen-vgw
milescremen-vgw force-pushed the fix/texture-packer-multipack-per-bin-dimensions branch from 7b659f8 to 825b545 Compare August 12, 2026 02:22
@milescremen-vgw
milescremen-vgw marked this pull request as ready for review August 12, 2026 02:25

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

If TexturePacker creates more than one atlas, it does not trim them individually to the correct size.

1 participant